﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;
using Entity;

namespace web.admin.scTask
{
    public partial class InnerCheck : System.Web.UI.Page
    {
        ContestService ContestService = new ContestService();
        CompetitionService competitionService = new CompetitionService();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string ContestId = Request["id"];
                if (ContestId == null)
                    return;

                ModifyContest(ContestId);

                BoContests contest = new BoContests();
                contest.CON_ID = ContestId;
                RpList.DataSource = ContestService.GetContestProcedures(contest);
                RpList.DataBind();
            }
        }
        protected void ModifyContest(string ContestId)
        {
            BoContests Contest = ContestService.getContest(ContestId);

            CON_NAMEBOX.Value = Contest.CON_ID;
            TextBoxName.Text = Contest.CON_NAME;

            TextBoxCreator.Text = Contest.CON_CREATOR;
            TextBoxStartTime.Text = Contest.CON_STARTTIME.ToString();
            TextBoxEndTime.Text = Contest.CON_ENDTIME.ToString();
            TextBoxADDRESS.Text = Contest.CON_ADDRESS;
            TextBoxTEACHERS.Text = Contest.CON_TEACHERS;
            AuditList.SelectedValue = Contest.CON_ISCHECK.ToString();
            //KindEditor.Text = Contest.CON_CONTENTS;

        }

        protected void ButtonOK_Click(object sender, EventArgs e)
        {

            if (CON_NAMEBOX.Value != "")
            {
                BoContests Contests = ContestService.getContest(CON_NAMEBOX.Value);
                Contests.CON_ISCHECK = Int32.Parse(AuditList.SelectedValue);
                ContestService.UpdateContest(Contests);
                Response.Redirect("InnerPro.aspx?PageCode=Audit");
            }
        }
    }
}